package com.example.myapplication.view;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import com.example.myapplication.R;
import com.example.myapplication.status2.StatusChangeView;
import com.example.myapplication.status2.StatusContext;

public class MainActivity extends AppCompatActivity implements StatusChangeView {

    private Button btn;
    private TextView textview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn = (Button) findViewById(R.id.btn);
        textview = (TextView) findViewById(R.id.tv);
        StatusContext statusContext = new StatusContext(this);
        btn.setOnClickListener(v -> {
            statusContext.changeEvent(null);
        });
    }

    @Override
    public void updateView(String status) {
        btn.setText(status);
    }
}
